package com.rs.game.player.dialogues;

import com.rs.game.WorldTile;
import com.rs.game.player.content.LavaFlowMines;
import com.rs.game.player.content.Magic;
import com.rs.game.player.controlers.Falconry;

public class SkillingTeleports extends Dialogue {

	public void start() {
		sendOptionsDialogue("Skilling Locations", "Achievement Capes", "Fishing", "Summoning", "Woodcutting", "More Options");
	}

	public void run(int interfaceId, int componentId) {
		if (stage == -1) {
			if (componentId == OPTION_1) {// Skillcapes
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3499, 3620, 0));

			} else if (componentId == OPTION_2) {// Fishing
				sendOptionsDialogue("Fishing", "Living Rock Caverns", "Fishing Guild");
				stage = 3;

			} else if (componentId == OPTION_3) {// Summoning
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2926, 3448, 0));

			} else if (componentId == OPTION_4) {// Woodcutting
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2726, 3484, 0));

			} else if (componentId == OPTION_5) {// More Options
				sendOptionsDialogue("Skilling Locations", "Mining", "Agility", "Hunter", "Runecrafting", "More Options");
				stage = 2;
			}

		} else if (stage == 3) {
			if (componentId == OPTION_1) {// Living Rocks
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3651, 5122, 0));
			} else if (componentId == OPTION_2) {// Guild
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2591, 3420, 0));
			} else {
				finish();
			}

		} else if (stage == 2) {
			if (componentId == OPTION_1) {// Mining
				sendOptionsDialogue("Mining Teleports", "Mining", "LavaFlow Mines", "Back");
				stage = 7;
			} else if (componentId == OPTION_2) {// Agility
				sendOptionsDialogue("Agility", "Gnome Agility Course", "Barbarian Outpost Course", "Wilderness Course (!Dangerous!)");
				stage = 4;
			} else if (componentId == OPTION_3) {// Hunter
				sendOptionsDialogue("Hunter Teleports", "Hunter", "Falconry");
				stage = 6;
			} else if (componentId == OPTION_4) {// Runecrafting
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2599, 3159, 0));
			} else if (componentId == OPTION_5) {// More Options
				sendOptionsDialogue("Skilling Locations", "Dungeoneering", "Farming");
				stage = 5;
			}
		} else if (stage == 4) {
			if (componentId == OPTION_1) {// Gnome
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2472, 3438, 0));
			} else if (componentId == OPTION_2) {// Barbarian Outpost
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2552, 3556, 0));
			} else 	if (componentId == OPTION_3) {
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2998, 3915, 0));
				player.getControlerManager().startControler("Wilderness");
			}
		} else if (stage == 5) {
			if (componentId == OPTION_1) { // Dungeoneering
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3449, 3698, 0));
			} else if (componentId == OPTION_2) { // Farming
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3056, 3309, 0));
			}
		} else if (stage == 6 ) {
			if (componentId == OPTION_1) { 
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(2525, 2916, 0));
				end ();
			} else if (componentId == OPTION_2) {
				if (player.getEquipment().hasShield() || player.getEquipment().hasTwoHandedWeapon() || player.getEquipment().getWeaponId() != -1) {
					player.getPackets().sendGameMessage("Please free your hands before going here.");
					end();
				} else {
					Falconry.beginFalconry(player);
				}
			}
		}else if (stage == 7) {
			if (componentId == OPTION_1) { 
				Magic.sendNormalTeleportSpell(player, 0, 0, new WorldTile(3298, 3285, 0));
			} 
			if (componentId == OPTION_2) { 
				LavaFlowMines.Entering(player);
			}
			if (componentId == OPTION_3) {
				sendOptionsDialogue("Skilling Teleports", "Mining", "Agility", "Hunter", "Runecrafting", "More");
				stage = 2;
			}
		}
	}

	public void finish() {
	}

}